import { getQueryParams } from '@/utils';
import http from './http';

export default {
  /**
   * @description: 查询物流公司列表
   * @param {type}
   * @return:
   */
  getDeliveries(params) {
    return http
      .get(`/mall/web/delivery/v1/deliveries?${getQueryParams(params)}`)
      .exec();
  },

  // 绑定物流账号
  bindAccount(params) {
    return http.post(`/mall/web/express/v1/account/bind`, params).exec();
  },
  // 解绑物流账号
  unbindAccount(params) {
    return http.post(`/mall/web/express/v1/account/unbind`, params).exec();
  },
  // 密码显示/隐藏
  setAccountVisible(params) {
    return http.post(`/mall/web/express/v1/account/visible`, params).exec();
  },
  // 删除物流账号
  deleteAccount(params) {
    return http.post(`/mall/web/express/v1/account/delete`, params).exec();
  },
  // 查询物流账号-分页
  getAccountList(params) {
    return http
      .get(`/mall/web/express/v1/account/pagination?${getQueryParams(params)}`)
      .exec();
  },

  /** 发件人 */

  // 查询可用的快递发件人信息
  getSenderList(params) {
    return http
      .get(`/mall/web/express/v1/sender/list?${getQueryParams(params)}`)
      .exec();
  },
  // 查询可用的快递发件人信息-分页
  getSenderListPage(params) {
    return http
      .get(`/mall/web/express/v1/sender/listpage?${getQueryParams(params)}`)
      .exec();
  },
  // 新增发件人
  addSender(params) {
    return http.post(`/mall/web/express/v1/sender/add`, params).exec();
  },
  // 删除发件人
  deleteSender(params) {
    return http.post(`/mall/web/express/v1/sender/delete`, params).exec();
  },
  // 修改发件人
  modifySender(params) {
    return http.post(`/mall/web/express/v1/sender/modify`, params).exec();
  },
  // 设置为可用
  setActiveSender(params) {
    return http.post(`/mall/web/express/v1/sender/setActive`, params).exec();
  },
  // 设置为默认
  setDefaultSender(params) {
    return http.post(`/mall/web/express/v1/sender/setDefault`, params).exec();
  },
};
